

import random
import demjson
import chardet
call_str = "{origination_caller_id_number=%s},origination_caller_id_name=%s}}user/%s" % ('show_num', 'show_num','args')
print(call_str)

print("sss:%s" % 'ssswww')

a = None
print("s:"+ ("" if a is None else str(a)))

b = 1
print("b type:"+ ("int" if isinstance(b,int) else "not int"))

print("fadfadf {} ,sdfadfad{},asdfasdf".format("hello","world") )


d = [
    {'host': '172.16.200.35', 'port': 1},
    {'host': '172.16.200.36', 'port': 2},
    {'host': '172.16.200.37', 'port': 3},
    {'host': '172.16.200.38', 'port': 3},
    {'host': '172.16.200.39', 'port': 4},
    {'host': '172.16.200.40', 'port': 44}
]

print([dd['host'] for dd in d if dd['port'] is 3])


li = [1]
print(random.choice(li))


d = {
    "1111":"1",
    "11111":"1",
    "11112":"12",
    "11113":"13"
}
print([x for x, y in d.items() if y is '1' ])

jsond  = demjson.encode(d)
print(type(jsond))
print(jsond)


print(chardet.detect(bytes("jsond")))